/*
 * Copyright 2011 The Rusted Roof, LLC.
 *
 *    Licensed under the Apache License, Version 2.0 (the "License");
 *    you may not use this file except in compliance with the License.
 *    You may obtain a copy of the License at
 *
 *        http://www.apache.org/licenses/LICENSE-2.0
 *
 *    Unless required by applicable law or agreed to in writing, software
 *    distributed under the License is distributed on an "AS IS" BASIS,
 *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *    See the License for the specific language governing permissions and
 *    limitations under the License.
 */

package org.proteusframework.core.api;

import org.proteusframework.core.api.ext.IAdapterManager;

/**
 * Mandatory interface that every unique platform runtime engine must provide.
 *
 * @author Tacoma Four
 */
public interface IPlatformProvider
{
    /**
     * Bootstrap the platform, creating a platform-specific instance of an <code>IProteusApplication</code>.
     *
     * @return Non-null <code>IProteusApplication</code> that can be started up.
     */
    IProteusApplication initialize();

    /**
     * Obtains an <code>IRuntimeEngine</code> that will be immediately injected into the
     * <code>IProteusApplication</code>. This step is separate from the initialization of the
     * <code>IProteusApplication</code> to support maximum framework flexibility.
     *
     * @return Non-null runtime engine that is immediatley bound to the Proteus application
     */
    IRuntimeEngine getRuntimeEngine();

    /**
     * Adapter manager for re-purposing existing plugin instances. This pattern is identical to the one utilized
     * by the Eclipse platform.
     *
     * @return Adapter manager
     */
    IAdapterManager getAdapterManager();

    /**
     * Load the plugin registrars via the <code>ServiceLoader</code> to locate all properly declared
     * {@link org.proteusframework.core.spi.ProteusRegistrarFactory} definitions.
     */
    void loadPlugins();
}
